<template>
  <div class="s1" v-show="llList.length">
    <div class="s11">
      <div class="s11-1">
        <div class="smn" @click="toshow()">
          <div class="">时间</div>
          <i class="el-icon-arrow-down" v-if="show"></i>
          <i class="el-icon-arrow-up" v-else></i>
        </div>
        <div class="smn1" v-if="show">
          <el-checkbox-group v-model="nianfen" @change="shunianfen">
            <el-checkbox
              v-for="tag in yearList"
              :key="tag.mc"
              :label="tag.mc"
              :checked="true"
              >{{ tag.mc }}</el-checkbox
            >
          </el-checkbox-group>
        </div>
      </div>
      <div class="s11-1">
        <div class="smn" @click="toshow1()">
          <div class="">类别</div>
          <i class="el-icon-arrow-down" v-if="show1"></i>
          <i class="el-icon-arrow-up" v-else></i>
        </div>
        <div class="smn1" v-if="show1">
          <el-checkbox-group v-model="type" @change="shulb">
            <el-checkbox v-for="tag in time1" :key="tag.id" :label="tag.id">{{
              tag.mc
            }}</el-checkbox>
          </el-checkbox-group>
        </div>
      </div>
      <!-- <div class="s11-1" style="margin-bottom:0">
            <div class="smn" @click="toshow2()">
                <div class="">级别</div>
                <i class="el-icon-arrow-down" v-if="show2"></i>
                <i class="el-icon-arrow-up" v-else></i>
            </div>
            <div class="smn1" v-if="show2">
                <el-radio v-for="(item,index) in time2" :key="index" v-model="radio2" :label="item.id">{{item.name}}</el-radio>
            </div>
        </div> -->
    </div>
    <div class="s12">
      <div class="cont">
        <div class="cont-1">
          <div>检索范围：
            <span v-for="i in type" :key="i">
              <span v-if="i == 69">论文,</span>
              <span v-if="i == 70">课题,</span>
              
            </span>
          </div>
          <div style="padding-left: 24px">主题：<span>{{keyword}}</span></div>
        </div>
        <div class="cont-2">
          <div>共找到<span>{{total}}</span>条结果</div>
          <!-- <div class="shuliang">1/321</div> -->
        </div>
      </div>
      <div class="cont1">
        <div class="cont1-3">
          <div
            style="
              display: flex;
              justify-content: flex-end;
              align-items: center;
            "
          >
            排序： <span>相关度</span
            ><img src="../../assets/images/pxs.png" alt="" />
          </div>
          <div style="padding-left: 12px">发表时间 : 综合</div>
        </div>
        <div class="cont1-2">
          <div>每页显示</div>
          <div>
            <el-select v-model="value" placeholder="">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                @click.native="partTypesClick"
              >
              </el-option>
            </el-select>
          </div>

          <div>条</div>
        </div>
      </div>

      <div class="cont2" v-for="(item, index) in llList" :key="item.lwid" v-show="item.wxlx ==69"  @click="tolw(item.wxlx,item.lwid)">
        <div class="righ" >
          <div class="mcs">
            <div class="mc">{{item.lwmc}} <span class="biaoti">(论文)</span></div>
            <div class="mc1">
              <img src="../../assets/images/s1.png" alt="" />
              <div>收藏</div>
            </div>
          </div>
          <div class="fx">
            <span>来源：{{item.lwly}}</span>
            <el-divider direction="vertical" v-if="item.lwhjjbname"></el-divider>
            <span>{{item.lwhjjbname}}</span>
            <el-divider direction="vertical" v-if="item.lwfbsj"></el-divider>
            <span>{{item.lwfbsj}}</span>
          </div>
          <div class="nr" v-html="item.lwqw">
            
          </div>
        </div>
      </div>
      <div class="cont2" v-for="(item, index) in llList" :key="item.ktid" v-show="item.wxlx ==70" @click="tolw(item.wxlx,item.ktid)" >
        <div class="righ" >
          <div class="mcs">
            <div class="mc">{{item.ktmc}} <span class="biaoti">(课题)</span></div>
            <div class="mc1">
              <img src="../../assets/images/s1.png" alt="" />
              <div>收藏</div>
            </div>
          </div>
          <div class="fx">
            <span>{{item.ktfzr}}</span>
            <el-divider direction="vertical" v-if="item.ktjbname"></el-divider>
            <span>{{item.ktjbname}}</span>
            <el-divider direction="vertical" v-if="item.ktztc"></el-divider>
            <span>{{item.ktztc}}</span>
            <el-divider direction="vertical" v-if="item.ktcjsj"></el-divider>
            <span>{{item.ktcjsj | dataFormat}} - {{item.ktjtsj | dataFormat}}</span>
            <el-divider direction="vertical" v-if="item.lwfbsj"></el-divider>
            <span>{{item.lwfbsj}}</span>
          </div>
          <div class="nr" v-html="item.ktyjly">
            
          </div>
        </div>
      </div>
      <div class="cont3">
       <el-pagination
          background
          layout="prev, pager, next"
          :total="total"
          @current-change="handleCurrentChange"
          :page-size="value * 1"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<style scoped  lang="scss">
::v-deep .el-checkbox-group {
  display: flex;
  flex-direction: column;
  font-size: 0;
  
}
::v-deep .el-checkbox {
  padding-bottom: 12px;
}
::v-deep .el-checkbox__label {
  font-size: 12px;
  font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  font-weight: 400;
  color: #333333;
}
// 分页
::v-deep .el-pagination.is-background .el-pager li {
  background-color: #fff;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #911f23;
  color: #fff;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled):hover {
  color: #911f23;
}
//分页数
::v-deep .el-select-dropdown__item.selected {
  color: #911f23 !important;
}
::v-deep .el-input__inner {
  color: #911f23;
}

::v-deep .el-checkbox__input.is-checked + .el-checkbox__label {
  color: #333;
}
::v-deep .el-divider--vertical {
  height: 15px;
}
::v-deep .el-radio {
  .el-radio__input {
    .el-radio__inner {
      border-radius: 2px;
    }
  }
  .el-radio__input.is-checked .el-radio__inner::after {
    content: "";
    width: 8px;
    height: 3px;
    border: 2px solid white;
    border-top: transparent;
    border-right: transparent;
    text-align: center;
    display: block;
    position: absolute;
    top: 2px;
    left: 1px;
    vertical-align: middle;
    transform: rotate(-45deg);
    border-radius: 0px;
    background: none;
  }
}
::v-deep .el-radio {
  line-height: 30px;
  display: block;
  .el-radio__label {
    font-size: 12px;
    font-family: Source Han Sans CN-Regular, Source Han Sans CN;
    font-weight: 400;
    color: #333333;
    span {
      color: #999999;
      padding-left: 10px;
    }
  }
}
::v-deep .el-input--suffix .el-input__inner {
  width: 70px;
  height: 22px;
  margin: 0 6px;
}
/*右侧图标样式  \e790下箭头图标*/
::v-deep .el-select .el-input .el-select__caret.el-input__icon::before {
  content: " \e790";
  color: #333333;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
}
::v-deep .el-select .el-input .el-select__caret {
  transform: rotateZ(0deg);
}

.s1 {
  width: 1400px;
  margin: 24px auto 90px;
  display: flex;
  justify-content: space-between;
  .s11 {
    width: 240px;
    .s11-1 {
      width: 100%;
      // height: 376px;
      margin-bottom: 24px;
      .smn {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: calc(100% - 32px);
        height: 46px;
        background-color: #f2f2f2;
        border-radius: 8px 8px 0px 0px;
        padding: 0 16px;
        font-size: 14px;
        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
        font-weight: 400;
        color: #333333;
        cursor: pointer;
      }
      .smn1 {
        width: calc(100% - 32px);
        max-height: 300px;
        overflow: auto;
        padding: 18px 16px 12px;
        background-color: #fff;
        border-radius: 0px 0px 8px 8px;
        // line-height: 45px;
      }
    }
  }
  .s12 {
    width: 1140px;
    .cont {
      width: 100%;
      display: flex;
      justify-content: space-between;
      .cont-1 {
        display: flex;
        font-size: 14px;
        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
        font-weight: 400;
        color: #333333;
        span {
          color: #911f23;
        }
      }
      .cont-2 {
        display: flex;
        font-size: 14px;
        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
        font-weight: 400;
        color: #666666;
        span {
          color: #911f23;
          padding: 0 4px;
        }
        .shuliang {
          padding-left: 24px;
        }
      }
    }
    .cont1 {
      width: calc(100% - 32px);
      height: 48px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 16px;
      background: #ffffff;
      border-radius: 8px 8px 8px 8px;
      margin-top: 16px;
      .cont1-1 {
        width: 40%;
        display: flex;
        .cont1-12 {
          font-size: 14px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #333333;
          padding-left: 12px;
          span {
            padding: 0 6px;
            color: #911f23;
          }
        }
        .cont1-13 {
          margin-left: 12px;
          width: 44px;
          height: 22px;
          background: #911f23;
          border-radius: 4px 4px 4px 4px;
          opacity: 1;
          display: flex;
          justify-content: center;
          align-items: center;
          font-size: 14px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #ffffff;
        }
        .cont1-14 {
          margin-left: 12px;
          width: 72px;
          height: 20px;
          border-radius: 4px 4px 4px 4px;
          opacity: 1;
          border: 1px solid #911f23;
          display: flex;
          justify-content: center;
          align-items: center;
          font-size: 14px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #911f23;
        }
      }
      .cont1-2 {
        width: 20%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        font-size: 14px;
        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
        font-weight: 400;
        color: #333333;
      }
      .cont1-3 {
        width: 40%;
        display: flex;
        // justify-content: flex-end;
        align-items: center;
        font-size: 14px;
        font-family: Source Han Sans CN-Regular, Source Han Sans CN;
        font-weight: 400;
        color: #333333;
        img {
          // padding-top: 8px;
          height: 20px;
          width: 20px;
        }
        span {
          color: #911f23;
        }
      }
    }
    .cont2 {
      width: calc(100% - 32px);
      padding: 16px;
      background: #ffffff;
      border-radius: 8px 8px 8px 8px;
      opacity: 1;
      margin-top: 12px;
      display: flex;
      cursor: pointer;
      .left {
        width: 0%;
      }
      .righ {
        width: 100%;
        .mcs {
          width: 100%;
          display: flex;
          justify-content: space-between;
          // align-items: center;
          .mc {
            font-size: 18px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 600;
            color: #3d3d3d;
            .biaoti{
              font-size: 14px;
              font-family: Source Han Sans CN-Regular, Source Han Sans CN;
              font-weight: 400;
              color: #911f23;
            }
          }
          .mc1 {
            display: flex;
            align-items: center;
            font-size: 12px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 400;
            color: #333333;
            justify-content: flex-end;
            img {
              width: 16px;
              height: 16px;
            }
          }
        }
        .fx {
          margin-top: 16px;
          font-size: 12px;
          font-family: Source Han Sans CN-Regular, Source Han Sans CN;
          font-weight: 400;
          color: #666666;
          display: flex;
          align-items: center;
        }
        .nr {
            width: 100%;
            margin-top: 16px;
            font-size: 12px;
            font-family: Source Han Sans CN-Regular, Source Han Sans CN;
            font-weight: 400;
            color: #666666;
            line-height: 20px;
            overflow:hidden;
            text-overflow: ellipsis;
            -webkit-line-clamp: 3;
            display: -webkit-box;
            -webkit-box-orient: vertical;
        }
      }
    }
    .cont3 {
      width: 1400px;
      margin-top: 16px;
      text-align: center;
      transform: translateX(-10%);
    }
  }
}
</style>

<script>
import { getyear, getlilun,getdanxiangll } from "@/api/api.js";
export default {
  props: ["sznum","shuzinum"],
  data() {
    return {
       keyword:'',
      options: [
       
        {
          value: "10",
          label: "10",
        },
        {
          value: "20",
          label: "20",
        },
        {
          value: "30",
          label: "30",
        },
        {
          value: "50",
          label: "50",
        },
        {
          value: "100",
          label: "100",
        },
      ],
      value: "10",
      radio: "0",
      radio1: "0",
      radio2: "0",
      time: [
        { id: 1, name: "2023", name1: "400" },
        { id: 2, name: "2023", name1: "400" },
        { id: 3, name: "2023", name1: "400" },
        { id: 4, name: "2023", name1: "400" },
        { id: 5, name: "2023", name1: "400" },
        { id: 6, name: "2023", name1: "400" },
        { id: 7, name: "2023", name1: "400" },
        { id: 8, name: "2023", name1: "400" },
        { id: 9, name: "2023", name1: "400" },
        { id: 10, name: "2023", name1: "400" },
      ],
      time1: [
        { id: 1, name: "门类" },
        { id: 2, name: "门类" },
        { id: 3, name: "门类" },
      ],
      time2: [
        { id: 1, name: "国家级" },
        { id: 2, name: "省级" },
        { id: 3, name: "市级" },
        { id: 4, name: "县级" },
      ],
      show: true,
      show1: true,
      show2: true,

      checkAll: false,
      isALL: false, // 全选框是否在勾选状态
      tableData: [
        {
          id: "1",
          code: "Y000028",
          name: "医疗",
        },
        {
          id: "2",
          code: "Y000029",
          name: "场馆",
        },
        {
          id: "3",
          code: "Y000030",
          name: "机场站房",
        },
      ], //全部数据
      bushForm: [], //选中的数据
      yearList: [],
      nianfen: [],
      time1: [
        { id: 69, mc: "论文", fid: 68, num: 0, children: [] },
        { id: 70, mc: "课题", fid: 68, num: 0, children: [] },
      ],
      type: [69],
      llList: [],
      total: 0,
      pageIndex: 1,
      pageSize: 10,
      jibie: "",
      danlei:0
    };
  },
  created() {
  
    this.getYear();

   
  },
  mounted() {
    // this.drawChart()
  },
   watch: {
    sznum(val) {
      this.keyword = this.shuzinum.jsInputBookname
      sessionStorage.setItem("sousuos", this.keyword );
      this.lilun();
    },
  },
  methods: {
    tolw(id,lx){
      if(id==69){
        const {href} = this.$router.resolve({ path: "/lw", query: { id: id ,lx:lx} });
        window.open(href, '_blank');
      }else{
        const {href} = this.$router.resolve({ path: "/kt", query: { id: id ,lx:lx} });
        window.open(href, '_blank');
      }
    },
    async lilunmax(){
      let formData = new FormData();
      // 调用append()方法添加数据
      formData.append("jibie", this.jibie);
      formData.append("keyword", this.keyword);
      formData.append("pageIndex", this.pageIndex);
      formData.append("pageSize", this.pageSize);
      // formData.append("zhaopian", this.up1);
      if (this.type.length != 0) {
        this.type.map((item, index) => {
          formData.append("type ", item);
        });
      }
      if (this.nianfen.length != 0) {
        this.nianfen.map((item, index) => {
          formData.append("year ", item);
        });
      }

      let res = await getdanxiangll(formData);
      this.llList = res.list;
      this.total = res.total;
    },
    partTypesClick(e) {
      this.pageSize = this.value;
      this.lilun();
      
    },
     handleCurrentChange(val) {
        this.llList = []
        this.pageIndex = val;
        this.lilun();
    },
    async lilun() {
      let formData = new FormData();
      // 调用append()方法添加数据
      formData.append("jibie", this.jibie);
      formData.append("keyword", this.keyword);
      formData.append("pageIndex", this.pageIndex);
      formData.append("pageSize", this.pageSize);
      // formData.append("zhaopian", this.up1);
      if (this.type.length != 0) {
        this.type.map((item, index) => {
          formData.append("type ", item);
        });
      }
      if (this.nianfen.length != 0) {
        this.nianfen.map((item, index) => {
          formData.append("year ", item);
        });
      }

      let res = await getlilun(formData);
      
      this.llList = res.list;
      this.total = res.total;
    },
    shulb(val) {
      this.llList = []
      this.pageIndex = 1
      this.type = val;
      this.lilun();
    },
    shunianfen(val) {
      this.llList = []
      this.pageIndex = 1
      this.nianfen = val;
      this.lilun();
    },

    async getYear() {
      this.nianfen = [];
      let res = await getyear();
      if (res.code == 200) {
        this.yearList = res.data;
      }
    },
    towenxian(id) {
      this.$router.push({ path: "/literature", query: { id: id } });
    },
    handleCheckAllChangeSales(val) {
      this.bushForm = [];
      var checkedsItem = val ? this.tableData : [];
      if (checkedsItem.length > 0) {
        checkedsItem.forEach((item) => {
          this.bushForm.push(item.id);
        });
      } else {
        this.bushForm = [];
      }
      this.isALL = false;
    },

    handleCheckedColumnChangeSales(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.tableData.length;
      this.isALL = checkedCount > 0 && checkedCount < this.tableData.length;
    },
    toshow() {
      this.show = !this.show;
    },
    toshow1() {
      this.show1 = !this.show1;
    },
    toshow2() {
      this.show2 = !this.show2;
    },
  },
  computed: {},
  components: {},
};
</script>
